import Logs.AdjustedBranchUpdate
import Utility.FileMode
import qualified Utility.RawFilePath as R
+import qualified Utility.FileIO as F
import Data.Time.Clock.POSIX
import qualified Data.Map as M
-- origbranch.
_ <- propigateAdjustedCommits' True origbranch adj commitlck
- origheadfile <- inRepo $ readFileStrict . fromRawFilePath . Git.Ref.headFile
+ origheadfile <- inRepo $ F.readFile' . toOsPath . Git.Ref.headFile
origheadsha <- inRepo (Git.Ref.sha currbranch)
b <- adjustBranch adj origbranch
newheadfile <- case origheadsha of
Just s -> do
inRepo $ \r -> do
- let newheadfile = fromRef s
- writeFile (fromRawFilePath (Git.Ref.headFile r)) newheadfile
+ let newheadfile = fromRef' s
+ F.writeFile' (toOsPath (Git.Ref.headFile r)) newheadfile
return (Just newheadfile)
_ -> return Nothing
unless ok $ case newheadfile of
Nothing -> noop
Just v -> preventCommits $ \_commitlck -> inRepo $ \r -> do
- v' <- readFileStrict (fromRawFilePath (Git.Ref.headFile r))
+ v' <- F.readFile' (toOsPath (Git.Ref.headFile r))
when (v == v') $
- writeFile (fromRawFilePath (Git.Ref.headFile r)) origheadfile
+ F.writeFile' (toOsPath (Git.Ref.headFile r)) origheadfile
return ok
| otherwise = preventCommits $ \commitlck -> do
{- Package version determination. -}
-{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE LambdaCase, OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Build.Version where
import Utility.Monad
import Utility.Exception
-import Utility.Misc
+import Utility.OsPath
+import Utility.FileSystemEncoding
+import qualified Utility.FileIO as F
type Version = String
middle = drop 1 . init
writeVersion :: Version -> IO ()
-writeVersion ver = catchMaybeIO (readFileStrict f) >>= \case
+writeVersion ver = catchMaybeIO (F.readFile' f) >>= \case
Just s | s == body -> return ()
- _ -> writeFile f body
+ _ -> F.writeFile' f body
where
- body = unlines $ concat
+ body = encodeBS $ unlines $ concat
[ header
, ["packageversion :: String"]
, ["packageversion = \"" ++ ver ++ "\""]
, ""
]
footer = []
- f = "Build/Version"
+ f = toOsPath "Build/Version"
readLog1 :: FilePath -> IO [LogLine]
readLog1 file = catchDefaultIO [] $
- parseLog . encodeBL <$> readFileStrict file
+ parseLog <$> F.readFile (toOsPath (toRawFilePath file))
lookupKey1 :: FilePath -> Annex (Maybe (Key, Backend))
lookupKey1 file = do